** table Policy **

  

use "ESS.dta", clear

global controls "Female  Citizen  trend  University i.essround"

global FE "i.Country i.yrbrn"


* Immigration vars: imbgeco imueclt imsetmr imueclt

g Migrantseconomy_ordinal= imbgeco/10
g Migrantsculture_ordinal=imueclt/10
g Migrantsqualityoflife_ordinal=imwbcnt/10
g Allow_ordinal= (4-imsetm)/3
 
g Economy=0 if Migrantseconomy_ordinal<.6
replace Economy=1 if  Migrantseconomy_ordinal>.5
replace Economy=. if Migrantseconomy_ordinal==.

g Culture=0 if Migrantsculture_ordinal<.6
replace Culture=1 if  Migrantsculture_ordinal>.5
replace Culture=. if Migrantsculture_ordinal==.
 
g Life=0 if Migrantsqualityoflife_ordinal<.6
replace Life=1 if  Migrantsqualityoflife_ordinal>.5
replace Life=. if Migrantsqualityoflife==.
 
g Allow=0 if Allow_ordinal>.2
replace Allow=1 if Allow_ordinal<=.2

 
 
la var University "Graduate"
 
 
 
quietly: reg Economy Bologna $controls $FE  if University==1, vce(cluster Country)
gen sample_m=e(sample)
 

capture erase "T17.tex"

quietly eststo m1: reg Economy Bologna if University==1 & short==1 & sample_m==1, vce(cluster Country)
	quietly: sum Economy if short==1 & University==1
	estadd scalar ymean = r(mean)

	
quietly eststo m2: reg Economy Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Economy if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo m3: reg Economy Bologna  Female Citizen trend i.essround $FE if University==1 & short==1 & ImmigrantN==0, vce(cluster Country)
	quietly: sum Economy if short==1 & University==1  & ImmigrantN==0
	estadd scalar ymean = r(mean)  

quietly eststo m4: reg Economy Bologna  Female Citizen trend i.essround $FE if University==1 & short==1 & Jump==0, vce(cluster Country)
	quietly: sum Economy if short==1 & University==1  & Jump==0
	estadd scalar ymean = r(mean)

quietly eststo m5: reg Economy Bologna  Female Citizen trend i.essround $FE if Eduyears>14 & short==1, vce(cluster Country)
	quietly: sum Economy if short==1 & Eduyears>14   
	estadd scalar ymean = r(mean)	
	
	g M2=Economy
	replace Economy=Migrantseconomy_ordinal
quietly eststo m6: reg Economy Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Economy if short==1 & University==1
	estadd scalar ymean = r(mean)
	replace Economy=M2
	
quietly eststo m7: reg Economy Bologna  Female Citizen trend i.essround $FE if University==1 , vce(cluster Country)
	quietly: sum Economy if  University==1
	estadd scalar ymean = r(mean)
	
	replace Bologna=Bologna_g
 quietly eststo m8: reg Economy Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Economy if short==1 & University==1
	estadd scalar ymean = r(mean)
	replace Bologna=replaceBologna
	
 
quietly eststo m10: reg Economy Bologna c.Bologna#c.University University  Female Citizen trend i.essround $FE if short==1, vce(cluster Country)  
	quietly: sum Economy  if short==1 & University==1 
	estadd scalar ymean = r(mean)
	
	noisily esttab m1 m2 m3 m4 m5 m6 m7 m8  m10 using "T17.tex",  nolz drop(*cons *essround *trend *yrbrn  *Country Female Citizen)  booktabs label  b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) mtitles("\shortstack{Baseline  \\ \textcolor{white}{tentenna}}" "\shortstack{Main  \\ \textcolor{white}{tentenna}}" "\shortstack{Exclude  \\ immigrants}" "\shortstack{Exclude  \\  jump}" "\shortstack{Include  \\  droputs}"   "\shortstack{Ordinal  \\ DV}" "\shortstack{Long  \\ bwidths}" "\shortstack{Gradual \\ reform}"  "\shortstack{Triple \\ DiD}")  mgroups("\shortstack{\textbf{\normalsize OLS}\vspace*{.1cm}}" "\shortstack{\textbf{\normalsize Staggered DiD (TWFE)}\vspace*{.1cm}}", pattern(0  1  0 0 0 0 0 0 0  ) prefix(\multicolumn{@span}{c}{) suffix(})  span erepeat(\cmidrule(lr){@span}))  stats(ymean r2   N, fmt(3 3  %9.0fc) labels(`"Output mean"' `"\textit{R}-sq"'   `"N. Obs"')) nonotes  noobs nonumbers  noeqlines coeflabels(Bologna "Reform" c.Bologna#c.University "Reform $\times$ Graduate")  ///
	 prehead("\begin{table}[htbp]\centering \footnotesize \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}   \caption{\scshape Additional: Immigration attitudes in Section 5 \label{Policy}}  \begin{center}   \begin{threeparttable}   \begin{tabular}{l  ccccccccc} \toprule" )  ///
	 prefoot("[1.5ex] \cmidrule(lr{0.15em}){1-10}" ) ///
	 posthead("\midrule \\[-2ex] \\\\[-5ex] \multicolumn{10}{l}{\hspace{2cm} \textbf{A}: \small {\textbf{Immigration (economy)}: \textit{Migrants worsen/improve the country's economy}}}\\\\[-0.5ex]") ///
	 fragment ///
	 replace ///
	 
 
quietly: reg Culture Bologna  $controls $FE  if University==1, vce(cluster Country)
gen sample_e=e(sample)

quietly eststo e1: reg Culture Bologna   if University==1 & short==1 & sample_e==1, vce(cluster Country)
	quietly: sum Culture if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e2: reg Culture Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Culture if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e3: reg Culture Bologna  Female Citizen trend i.essround $FE if University==1 & short==1 & ImmigrantN==0, vce(cluster Country)
	quietly: sum Culture if short==1 & University==1  & ImmigrantN==0
	estadd scalar ymean = r(mean)  

quietly eststo e4: reg Culture Bologna  Female Citizen trend i.essround $FE if University==1 & short==1 & Jump==0, vce(cluster Country)
	quietly: sum Culture if short==1 & University==1  & Jump==0
	estadd scalar ymean = r(mean)

quietly eststo e5: reg Culture Bologna  Female Citizen trend i.essround $FE if Eduyears>14 & short==1, vce(cluster Country)
	quietly: sum Culture if short==1 & Eduyears>14 
	estadd scalar ymean = r(mean)	
	
	g E3=Culture
	replace Culture= Migrantsculture_ordinal
quietly eststo e6: reg Culture Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Culture if short==1 & University==1
	estadd scalar ymean = r(mean)
	replace Culture=E3
	
quietly eststo e7: reg Culture Bologna  Female Citizen trend i.essround $FE if University==1 , vce(cluster Country)
	quietly: sum Culture if  University==1
	estadd scalar ymean = r(mean)
	
	 replace Bologna=Bologna_g
 quietly eststo e8: reg Culture Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	 quietly: sum Culture if short==1 & University==1
	 estadd scalar ymean = r(mean)
	 replace Bologna=replaceBologna
	
 
quietly eststo e10: reg Culture Bologna c.Bologna#c.University  University Female Citizen trend i.essround $FE if short==1, vce(cluster Country)  
	quietly: sum Culture  if short==1 & University==1 
	estadd scalar ymean = r(mean)
	
	 noisily esttab  e1 e2 e3 e4 e5 e6 e7 e8  e10 using "T17.tex", nolz drop(*cons *essround *trend *yrbrn *Country Female Citizen)  booktabs label  b(3) se(3)  star(* 0.10 ** 0.05 *** 0.01) nomtitles nonumbers stats(ymean  r2  N  , fmt(3 3  %9.0fc ) labels(`"Output mean"' `"\textit{R}-sq"'   `"N. obs"'     ))  coeflabels(Bologna "Reform" c.Bologna#c.University "Reform $\times$ Graduate") ///
	posthead("\hline \\[-1ex]   \multicolumn{10}{l}{\hspace{2cm}   \textbf{B}: \small {\textbf{Immigration (culture)}: \textit{Migrants worsen/improve the country's culture}}} \\\\[-0.1ex]") ///
    prefoot("[1.5ex] \cmidrule(lr{0.15em}){1-10}" ) ///  
	fragment  ///
	append 

drop sample_e

quietly: reg Life Bologna   Female Citizen trend i.essround $FE  if University==1, vce(cluster Country)
gen sample_e=e(sample)

quietly eststo e1: reg Life Bologna   if University==1 & short==1 & sample_e==1, vce(cluster Country)
	quietly: sum Life if short==1 & University==1
	estadd scalar ymean = r(mean)
quietly eststo e2: reg Life Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Life if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e3: reg Life Bologna  Female Citizen trend i.essround $FE if University==1 & short==1 & ImmigrantN==0, vce(cluster Country)
	quietly: sum Life if short==1 & University==1  & ImmigrantN==0
	estadd scalar ymean = r(mean)  

quietly eststo e4: reg Life Bologna  Female Citizen trend i.essround $FE if University==1 & short==1 & Jump==0, vce(cluster Country)
	quietly: sum Life if short==1 & University==1  & Jump==0
	estadd scalar ymean = r(mean)

quietly eststo e5: reg Life Bologna  Female Citizen trend i.essround $FE if Eduyears>14 & short==1, vce(cluster Country)
	quietly: sum Life if short==1 & Eduyears>14  
	estadd scalar ymean = r(mean)	
	
	g E2=Life
	replace Life=Migrantsqualityoflife_ordinal
quietly eststo e6: reg Life Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Life if short==1 & University==1
	estadd scalar ymean = r(mean)
	replace Life=E2
	
quietly eststo e7: reg Life Bologna  Female Citizen trend i.essround $FE if University==1 , vce(cluster Country)
	quietly: sum Life if  University==1
	estadd scalar ymean = r(mean)
	
	 replace Bologna=Bologna_g
 quietly eststo e8: reg Life Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	 quietly: sum Life if short==1 & University==1
	 estadd scalar ymean = r(mean)
	 replace Bologna=replaceBologna
	

quietly eststo e10: reg Life Bologna c.Bologna#c.University University  Female Citizen trend i.essround $FE if short==1, vce(cluster Country)  
	quietly: sum Life  if short==1 & University==1 
	estadd scalar ymean = r(mean)
	
	
		 noisily esttab  e1 e2 e3 e4 e5 e6 e7 e8  e10 using "T17.tex", nolz  drop(*cons *essround *trend *yrbrn *Country Female Citizen)  booktabs label  b(3) se(3)  star(* 0.10 ** 0.05 *** 0.01) nomtitles nonumbers stats(ymean  r2  N  , fmt(3 3  %9.0fc ) labels(`"Output mean"' `"\textit{R}-sq"'   `"N. obs"'     ))  coeflabels(Bologna "Reform" c.Bologna#c.University "Reform $\times$ Graduate") ///
	posthead("\hline \\[-1ex]   \multicolumn{10}{l}{\hspace{2cm}   \textbf{C}: \small {\textbf{Immigration (culture)}: \textit{Migrants worsen/improve the country's quality of life}}} \\\\[-0.1ex]") ///
     prefoot("[1.5ex] \cmidrule(lr{0.15em}){1-10}" ) ///
	fragment  ///
	append 

	 

	drop sample_e
 
	
quietly: reg Allow Bologna  $controls $FE  if University==1, vce(cluster Country)
gen sample_e=e(sample)

quietly eststo e1: reg Allow Bologna   if University==1 & short==1 & sample_e==1, vce(cluster Country)
	quietly: sum Allow if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e2: reg Allow Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Allow if short==1 & University==1
	estadd scalar ymean = r(mean)
	
quietly eststo e3: reg Allow Bologna  Female Citizen trend i.essround $FE if University==1 & short==1 & ImmigrantN==0, vce(cluster Country)
	quietly: sum Allow if short==1 & University==1  & ImmigrantN==0
	estadd scalar ymean = r(mean)  

quietly eststo e4: reg Allow Bologna  Female Citizen trend i.essround $FE if University==1 & short==1 & Jump==0, vce(cluster Country)
	quietly: sum Allow if short==1 & University==1  & Jump==0
	estadd scalar ymean = r(mean)

quietly eststo e5: reg Allow Bologna  Female Citizen trend i.essround $FE if Eduyears>14 & short==1, vce(cluster Country)
	quietly: sum Allow if short==1 & Eduyears>14 
	estadd scalar ymean = r(mean)	
	
	g E4=Allow
	replace Right= Allow_ordinal
quietly eststo e6: reg Allow Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	quietly: sum Allow if short==1 & University==1
	estadd scalar ymean = r(mean)
	replace Right=E4
	
quietly eststo e7: reg Allow Bologna  Female Citizen trend i.essround $FE if University==1 , vce(cluster Country)
	quietly: sum Allow if  University==1
	estadd scalar ymean = r(mean)
	
	 replace Bologna=Bologna_g
 quietly eststo e8: reg Allow Bologna  Female Citizen trend i.essround $FE if University==1 & short==1, vce(cluster Country)
	 quietly: sum Allow if short==1 & University==1
	 estadd scalar ymean = r(mean)
	 replace Bologna=replaceBologna
	
 
quietly eststo e10: reg Allow Bologna c.Bologna#c.University University  Female Citizen trend i.essround $FE if short==1, vce(cluster Country)  
	quietly: sum Allow  if short==1 & University==1 
	estadd scalar ymean = r(mean)
	
	 noisily esttab  e1 e2 e3 e4 e5 e6 e7 e8  e10 using "T17.tex", nolz  drop(*cons *essround *trend *yrbrn *Country Female Citizen)  booktabs label  b(3) se(3)  star(* 0.10 ** 0.05 *** 0.01) nomtitles nonumbers stats(ymean  r2  N  , fmt(3 3  %9.0fc ) labels(`"Output mean"' `"\textit{R}-sq"'   `"N. obs"'     ))  coeflabels(Bologna "Reform" c.Bologna#c.University "Reform $\times$ Graduate") ///
	posthead("\hline \\[-1ex]   \multicolumn{10}{l}{\hspace{2cm}   \textbf{D}: \small {\textbf{Immigration (allow more)}: \textit{Allow few/many migrants from the same background}}} \\\\[-0.1ex]") ///
	prefoot("[1.5ex] \cmidrule(lr{0.15em}){1-10}") ///
  	postfoot("\toprule  \multicolumn{10}{l}{\hspace{2cm}  \small \scshape Common modelling assumptions}\\\\[-1ex] " ///
    "SES Controls &  no  &  yes  & yes &   yes  &     yes &   yes &   yes &   yes &   yes \\" ///
	"Cohorts &  78-92  &  78-92  & 78-92 &   72-98  &   78-92 &   78-92 &   78-92 &     78-92 &   78-92 \\" ///
	"Country FE  &  no  &  yes  & yes &   yes  &   yes &   yes &   yes &   yes &   yes  \\" ///
    "Cohort FE  &  no  &  yes  & yes &   yes  &   yes &   yes  &   yes &   yes \\  \toprule \end{tabular}  \begin{tablenotes} \setlength\labelsep{0pt}  \item \scriptsize {\textit{Notes.} Standard errors in parentheses. \sym{*} \(p<0.1\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\). See Table 1 in the paper.}  \end{tablenotes}   \end{threeparttable}   \end{center}  \end{table}" ) ///
	fragment ///
	append  	
	
	